using System;
using System.Collections.Generic;


namespace SpringNH.Model
{
	[Serializable]
	public class MyUsers: IEquatable<MyUsers>
	{

		#region 私有成员

		/// <summary>
		/// 
		/// </summary>

		private string _logonid; 
		/// <summary>
		/// 
		/// </summary>

		private string _username; 
		/// <summary>
		/// 
		/// </summary>

		private string _password; 
		/// <summary>
		/// 
		/// </summary>

		private string _emailaddress; 
		/// <summary>
		/// 
		/// </summary>

		private DateTime _lastlogon; 		
		#endregion

		#region Constructor

		public MyUsers()
		{
			_logonid = String.Empty; 
			_username = String.Empty; 
			_password = String.Empty; 
			_emailaddress = String.Empty; 
			_lastlogon = DateTime.MinValue; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public MyUsers(
			string logonid, 
			string username, 
			string password, 
			string emailaddress, 
			DateTime lastlogon)
			: this()
		{
			_logonid = logonid;
			_username = username;
			_password = password;
			_emailaddress = emailaddress;
			_lastlogon = lastlogon;
		}
		#endregion // End Constructor

		#region 公有属性
					

		/// <summary>
		/// 
		/// </summary>
		public virtual string LogonId
		{
			get
			{ 
				return _logonid;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for LogonId", value, "null");
				
				if(  value.Length > 40)
					throw new ArgumentOutOfRangeException("Invalid value for LogonId", value, value.ToString());
				
				_logonid = value;
			}
		}
					

		/// <summary>
		/// 
		/// </summary>
		public virtual string UserName
		{
			get
			{ 
				return _username;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for UserName", value, "null");
				
				if(  value.Length > 45)
					throw new ArgumentOutOfRangeException("Invalid value for UserName", value, value.ToString());
				
				_username = value;
			}
		}
					

		/// <summary>
		/// 
		/// </summary>
		public virtual string Password
		{
			get
			{ 
				return _password;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Password", value, "null");
				
				if(  value.Length > 45)
					throw new ArgumentOutOfRangeException("Invalid value for Password", value, value.ToString());
				
				_password = value;
			}
		}
					

		/// <summary>
		/// 
		/// </summary>
		public virtual string EmailAddress
		{
			get
			{ 
				return _emailaddress;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for EmailAddress", value, "null");
				
				if(  value.Length > 45)
					throw new ArgumentOutOfRangeException("Invalid value for EmailAddress", value, value.ToString());
				
				_emailaddress = value;
			}
		}
					

		/// <summary>
		/// 
		/// </summary>
		public virtual DateTime LastLogon
		{
			get
			{ 
				return _lastlogon;
			}
			set
			{
				_lastlogon = value;
			}

		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			MyUsers castObj = (MyUsers)obj; 
			return ( castObj != null ) &&
				( this._logonid == castObj.LogonId );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _logonid.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(MyUsers other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._logonid == other.LogonId );
				   
		}

		#endregion
		
	}
}
